//
//  File.swift
//  CooperSwift_Example
//
//  Created by 计海峰 on 2021/5/27.
//  Copyright © 2021 CocoaPods. All rights reserved.
//

import Foundation
import RxDataSources
import RxSwift

public struct ViewModelFactory {
    
    public typealias TableViewModelAlias = TableViewModelProtocol
    
    public static func tableVM<T: TableViewModelAlias>(_ cls: T.Type) -> T {
        let vm = cls.init()
        let setctions = [SectionModel<Any, TableCellConfigProtocol>]()
        vm.sections = setctions // 配置sections
        vm.sectionsSubject = BehaviorSubject(value: setctions) // 初始化 subjct
        vm.serviceSubject = BehaviorSubject(value: "") 
        return vm
    }
    
    
    public typealias CollectionViewModelAlias = CollectionViewModelProtocol
    public static func collectionVM<T: CollectionViewModelAlias>(_ cls: T.Type) -> T {
        let vm = cls.init()
        let setctions = [SectionModel<Any, CollectionCellConfigProtocol>]()
        vm.sections = setctions // 配置sections
        vm.sectionsSubject = BehaviorSubject(value: setctions) // 初始化 subjct
        vm.serviceSubject = BehaviorSubject(value: "")
        return vm
    }
    
}
